<template xmlns:v-on="http://www.w3.org/1999/xhtml">
  <div class="content">
      <!-- 头部 -->
    <div class="main-title">
      <ul>
        <li>
          <div @click="navBackClick(1)" class="main-title-left main-title-noSelect">
            首页
          </div>
          <div class="main-title-right">
            /
          </div>
        </li>
        <li>
          <div @click="navBackClick(2)" class="main-title-left main-title-noSelect">
            系统设置
          </div>
          <div class="main-title-right">
            /
          </div>
        </li>
        <li>
          <div class="main-title-left main-title-select">
            模板管理
          </div>
          <div class="main-title-right">
            <!-- / -->
          </div>
        </li>
      </ul>
    </div>
    <div class="content-center">
      <div class="main-list">
        <div class="content-list">
          <div class="content-list-top">
            默认offer模板
          </div>
          <div class="content-list-bottom">
            <div class="content-bottom-Left">
             <label for="imageFile">
                修改
              </label>
              <input id="imageFile" type="file"  @change="updateFile">
            </div>
            <div class="content-bottom-right" @click="lookClick">
              预览
            </div>
          </div>
        </div>
      </div>
      <div v-show="isShowLook" class="lookShow">
        <div class="main-lookShow">
          <div class="main-lookShow-top">
            <div>个人简历</div>
            <div @click="lookHideClick">X</div>
          </div>
          <div class="main-lookShow-bottom">

          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
require("../../../API/config.js");
import { mapActions } from "vuex";
import mDel from "../module/mDel";
export default {
  components: {
    "v-mDel": mDel
  },
  data() {
    return {
      modelName: "面试邀请模板",
      isShowLook: false,
      lists: [
        {
          id: 1,
          creator: 0,
          createDate: 0,
          lastModifier: 0,
          lastModDate: 0,
          deleteFlag: 1,
          name: "成意",
          phone: null,
          email: null,
          source: 1,
          position: null,
          workYear: null,
          sex: "男",
          hr: null,
          contactTime: null,
          status: null
        }
      ],
      mainContentShow: 0,
      ismainlistfeedback: true,
      ismainlistbasic: true,
      ismainlistselect: 0,
      isShowdel: true,
      toPath: "",
      titlename: "劳动成果还未保存，是否退出？",
      pageSizeNum: 10,
      currentPage: 1,
      totalNum: 1
    };
  },
  // 过滤
  filters: {
    timeFun: function(val) {
      var now = new Date(val);
      var year = now.getYear() - 100;
      var month = now.getMonth() + 1;
      month = month > 9 ? month : "0 " + month;
      var date = now.getDate();
      date = date > 9 ? date : "0 " + date;
      var hour = now.getHours();
      hour = hour > 9 ? hour : "0 " + hour;
      var minute = now.getMinutes();
      minute = minute > 9 ? minute : "0 " + minute;
      return (
        "20 " + year + "- " + month + "- " + date + " " + hour + ": " + minute
      );
    }
  },
  // 模块新建时
  created: function() {
    var self = this;
  },
  // 计算属性
  mounted() {},
  // 事件处理
  methods: {
    // 上传模板
    updateFile(e) {
      var self = this;
      var files = e.target.files || e.dataTransfer.files;
      if (files[0]) {
        var fileData = files[0];
        self.updateFileWork(fileData);
      }
    },
    updateFileWork(file) {
      var self = this;
      var formdata = new FormData();
      formdata.append("file", file);
      self
        .getuploaduploadOfferTemplate(formdata)
        .then(data => {
          if (data.code == 200) {
            self.$message({
              message: "模板文件成功!",
              type: "success"
            });
            self.upFileUrl = data.data.src;
          } else {
            self.$message({
              type: "info",
              message: data.message
            });
          }
        })
        .catch(msg => {
          this.$router.push({
            path: "/login"
          });
          self.$message({
            type: "info",
            message: "服务器异常!"
          });
        });
    },
    // 编辑
    updateClick() {},
    deleteClick() {
      this.isShowdel = false;
      this.titlename = "是否要删除该模板？";
    },
    confirmClick() {
      this.isShowdel = true;
    },
    //取消未保存弹出框
    cancelClick() {
      this.isShowdel = true;
    },
    // 预览
    lookHideClick() {
      this.isShowLook = false;
    },
    lookClick(index) {
      // this.isShowLook = true;
      window.open(
        "http://" + global.Ip + ":" + global.port + "/api/file/offerPreviewer"
      );
    },
    navBackClick(index) {
      if (index == 2) {
        this.$router.push({
          path: "/home/system"
        });
      } else if (index == 1) {
        this.$router.push({
          path: "/home/system"
        });
      }
    },
    ...mapActions(["getuploaduploadOfferTemplate"])
  },
  // 监视
  watch: {}
};
</script>
<style scoped>
.title-right {
  height: 50px;
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-r-but-right {
  min-width: 15px;
  font-size: 13px;
  color: #fff;
}

.title-r-but-left {
  width: 15px;
  height: 27px;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.title-r-but-left img {
  width: 100%;
  height: 100%;
  width: 15px;
  height: 15px;
}

.title-right-but {
  width: 90px;
  height: 30px;
  line-height: 30px;
  background-color: #2fa89e;
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-radius: 3px;
  cursor: pointer;
}
.content-list-top {
  width: 100%;
  height: 190px;
  font-size: 22px;
  color: #333;
  text-align: center;
  line-height: 190px;
  /* font-weight: 600; */
}
.content-list-bottom {
  width: 100%;
  height: 49px;
  display: flex;
  border-top: 1px solid #ccc;
}
.content-bottom-Left input {
  opacity: 0;
  width: 0;
  height: 0;
}
.content-bottom-Left {
  width: 190px;
  text-align: center;
  font-size: 15px;
  color: #fe966b;
  line-height: 50px;
  cursor: pointer;
  border-right: 1px solid #ccc;
  background-color: #f7f7f7;
  overflow: hidden;
}

.content-bottom-right {
  width: 190px;
  text-align: center;
  font-size: 15px;
  color: #333;
  line-height: 50px;
  cursor: pointer;
  background-color: #f7f7f7;
  overflow: hidden;
}
.content-list {
  width: 380px;
  height: 240px;
  border: 1px solid #ccc;
  margin-left: 50px;
  border-radius: 2px;
  display: flex;
  flex-wrap: wrap;
}
.main-list {
  margin-top: 20px;
  min-height: 500px;
}
.main-content {
  width: 100%;
  min-height: 500px;
}

.main-title-noSelect {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.65);
  cursor: pointer;
}
.main-title-select {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.85);
  font-weight: 600;
}

.main-title-right {
  width: 23px;
  text-align: center;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.65);
}

.main-title ul {
  width: 100%;
  display: flex;
  height: 54px;
  margin-left: 34px;
}
.main-title ul li {
  display: flex;
}
.main-title {
  width: 100%;
  height: 54px;
  background-color: #fff;
  line-height: 54px;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: inset 0px 3px 3px 0px #ccc;
}

.content {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: rgba(240, 242, 245, 1) !important;
  min-height: 350px;
  /* border: 1px solid red; */
  display: flex;
  flex-wrap: wrap;
}

.content-center {
  overflow: hidden;
  width: calc(100% - 48px);
  margin-left: 24px;
  background-color: #fff;
  margin-top: 24px;
  border-radius: 3px;
  min-height: calc(100% - 78px - 24px);
  margin-bottom: 24px;
}

/*取消弹出框*/

.delPopup {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.showdel {
  display: none;
}

.main-lookShow-top > div:nth-child(1) {
  font-size: 16px;
  font-weight: 600;
  color: #5c5c5c;
  margin-left: 20px;
}
.main-lookShow-top > div:nth-child(2) {
  margin-right: 20px;
  width: 35px;
  height: 35px;
  text-align: center;
  line-height: 35px;
  border: 1px solid #ccc;
  border-radius: 50%;
  cursor: pointer;
}

.main-lookShow-top {
  display: flex;
  justify-content: space-between;
  height: 55px;
  align-items: center;
}

.main-lookShow {
  width: 650px;
  height: 650px;
  background-color: #fff;
  border-radius: 5px;
}
.lookShow {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-fade-enter-active {
  transition: all 0.7s ease;
}

.slide-fade-enter,
.slide-fade-leave-active {
  transform: translateY(-30px);
  opacity: 0;
}
</style>